<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> -->
</head>

<body>
    <button onclick="bibao()"> a+1</button>
    <script>
        var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
        // console.log(arr.push(6, 5)); //7
        // console.log(arr);
        // console.log('-----------------');
        // console.log(arr.pop()); //5
        // console.log(arr); // [1, 2, 3, 4]
        // console.log('-----------------');
        // console.log(arr.unshift(-1, 0)); //7
        // console.log(arr);
        // console.log('-----------------');

        //splice方法
        // arr.splice(8)
        // console.log(arr);
        // a = arr.splice(1, 2)
        // console.log(arr, a);
        // arr.slice(2, 1, 1)
        // console.log(arr);
        // arr.splice(2, 3, 4, 4, 5, 6)
        // console.log(arr);

        // //shift方法
        // c = arr.pop(3)
        console.log(arr);
        console.log('-------------');

        //闭包
        function bibao() {
            var a = 5
            return () => {
                a = a + 1;
                console.log(a);
            }
        }
        console.log(bibao());
    </script>
</body>

</html>